#ifndef Ball_H
#define Ball_H

#include <QPainter>
#include <QGraphicsItem>
#include <QGraphicsScene>

class Ball : public QGraphicsItem
{
public:
    Ball();
    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void SetStart(bool bStart)
    {
        m_bStart = bStart;
    }
    void Reset()
    {
        xPos=yPos=-1;
        //random start position
        int StartX = 10;
        int StartY = 80;
        setPos(mapToParent(StartX,StartY));
        SetStart(false);
    }

protected:
    void advance(int phase);

private:
    qreal angle;
    qreal speed;
    qreal xPos,yPos;
    bool m_bStart;
    void DoCollision(QRectF rectLine);
};

#endif // Ball_H
